package cn.caplike.demo.shiro.auth.workflow;

import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;

/**
 * Description: 认证 & 授权 {@link org.apache.shiro.realm.Realm}.
 *
 * @author LiKe
 * @version 1.0.0
 * @date 2021-04-06 10:37
 */
@Slf4j
public class AuthRealm extends AuthorizingRealm {

    @Override
    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
        log.debug("AuthRealm#Authorizing :: doGetAuthorizationInfo principals: {}", JSON.toJSONString(principals));
        return null;
    }

    @Override
    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
        log.debug("AuthRealm#Authenticating :: doGetAuthenticationInfo token: {}", JSON.toJSONString(token));
        return null;
    }
}
